![]() QuickDraw GX
By Don Swatman |
CONTENTSThe'rdip' Resource - What Can It Do?The Planes Patching the Raster Preferences on the Fly Printing Each Plane in its Entirety Summary |
QuickDraw GX's
raster preferences ('rdip' ) resource gives raster printer
driver developers a great deal of control over how an image is rendered
for a printer -- without having to write the renderer themselves.
However, due to sparse documentation, many developers have become
confused as how to make best use of its features. This Technote:
To get the best out of this Note, I would strongly suggest looking at the "IW-Half-Dither" sample code. This can be found on the Developer CD series: Tool Chest Edition or by clicking here.
This Note is primarily intended for QuickDraw GX raster printer driver
developers who wish to use the |
Important for all Apple Printing and Graphics Developers:
The information in this Technote is still relevant up to and including Mac OS 7.6 with QuickDraw GX 1.1.5. Beginning with the release of Mac OS 8.0, however, Apple plans to deliver a system which incorporates QuickDraw GX graphics and typography only. QuickDraw GX printer drivers and GX printing extensions will not be supported in Mac OS 8.0 or in future Mac OS releases. Apple's goal is to simplify the user experience of printing by unifying the Macintosh graphic and printing architectures and standardizing on the classic Printing Manager. For details on Apple's official announcement, refer to </technotes/gxchange.html> |
The
|
Definition
The raster preferences ( The structure of raster preferences resources is shown in the following table:
Plane setup array:
|
General Setup Information (the top bit)
|
Plane OptionsFor each plane that you are generating, you need to supply plane
information. (This part of the resource is the same as
The other values in each plane depend on whether you require a halftoned or dithered image. |
Plane Values for DitheringAn example of the values used in dithered planes can be found on page 3-63 of Inside Macintosh: QuickDraw GX Printing Extensions and Drivers. Most of the fields are unused (and therefore ignored) for a dithered image. For general information on QuickDraw GX's dithering, see pages 7-10 to 7-13 of Inside Macintosh: QuickDraw GX Objects.
|
Plane Values for HalftoningThe following section deals with generating halftone images on a CMYK printer. To get this to work well, you need to render each of the 4 planes separately. For general information on QuickDraw GX's halftoning, see pages 7-13 to 7-17 of Inside Macintosh: QuickDraw GX Objects.
|
'rdip'
Resource for Halftoning on an ImageWriter II
resource gxRasterPrefsType (gxRasterPrefsID, sysheap, purgeable) { gxDefaultRaster, // default options are fine 0x00900000, 0x00900000, // 144X144 dpi device 16, // min band size == 2 head heights 0, // max band size (0 is full page) 0x00008000, // RAM percentage (50%) 100*1024, // RAM slop (100K) 4, // 4 bit device { // YELLOW plane. gxDefaultOffscreen, // Use default - halftoning. 0x000F0000, // Angle = 15 degrees 0x002D0000, // Freq = 45 gxRoundDot, // RoundDot dithering gxComponent3Tint, // Extract yellow and dither it gxRGBSpace, gxNoProfile, 0, 0, 0, 0, // DotColor == black gxRGBSpace, gxNoProfile, 0xFFFF, 0xFFFF, 0xFFFF, 0, // Background color == white gxCMYKSpace, // Convert to gxCMYKSpace before halftoning. gxNoSpace, // No explicit color space gxNoSet, // No color set gxNoProfile, // No profile specified // MAGENTA plane. gxDefaultOffscreen, // Use default - halftoning. 0x00000000, // Angle = 0 degrees 0x002D0000, // Freq = 45 gxRoundDot, // RoundDot dithering gxComponent2Tint, // extract magenta and dither it gxRGBSpace, gxNoProfile, 0, 0, 0, 0, // dotColor == black gxRGBSpace, gxNoProfile, 0xFFFF, 0xFFFF, 0xFFFF, 0, // background color == white gxCMYKSpace, // Convert to gxCMYKSpace before halftoning. gxNoSpace, // No explicit color space gxNoSet, // No color set gxNoProfile, // No profile specified // CYAN plane. gxDefaultOffscreen, // Use default - halftoning. 0x003C0000, // Angle = 60 degrees 0x002D0000, // Freq = 45 gxRoundDot, // RoundDot dithering gxComponent1Tint, // Extract cyan and dither it gxRGBSpace, gxNoProfile, 0, 0, 0, 0, // DotColor == black gxRGBSpace, gxNoProfile, 0xFFFF, 0xFFFF, 0xFFFF, 0, // Background color == white gxCMYKSpace, // Convert to gxCMYKSpace before halftoning. gxNoSpace, // No explicit color space gxNoSet, // No color set gxNoProfile, // No profile specified // BLACK plane. gxDefaultOffscreen, // Use default - halftoning. 0x002D0000, // Angle = 45 degrees 0x002D0000, // Freq = 45 gxRoundDot, // RoundDot dithering gxComponent4Tint, // Extract black and dither it gxRGBSpace, gxNoProfile, 0, 0, 0, 0, // DotColor == black gxRGBSpace, gxNoProfile, 0xFFFF, 0xFFFF, 0xFFFF, 0, // Background color == white gxCMYKSpace, // Convert to gxCMYKSpace before halftoning. gxNoSpace, // No explicit color space gxNoSet, // No color set gxNoProfile // No profile specified }; }; |
Patching the Raster Preferences on the FlyYou may wish to change the way a driver renders an image. For example, a
halftone image's angles may cause moire effects with the default angles
and frequencies; a slight change can fix this. However, it is not
possible to change how a GX driver renders by simply patching the
The way to do this is by overriding the universal image message,
It's possible to change many or just a few of the parameters, even whether the image is rendered halftoned or dithered. For an example of this, see the "IW-Half-Dither" sample code. |
SummaryThe'rdip' resource can very useful to QuickDraw GX printer driver
developers because it allows you to control how your images are rendered
without having to write the renderer for yourself. By its very flexible
nature, it is a very complicated data structure and often needs a small
amount of experimentation to achieve the desired effect. Hopefully, this
Technote will encourage you to write drivers that support GX
technologies to their fullest.
|
|
![]() ![]() |
Thanks to Jason Hodges-Harris, Ingrid Kelly, Jon Lansdell and Tom Maremaa for casting their knowledgeable eyes over this Technote. Finally, many thanks to Lorraine, my wife, who now needs the sound of an extended keyboard being typed to help her sleep.